/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.appintro.component;

import ohos.agp.components.AttrSet;
import ohos.agp.utils.Color;
import ohos.app.Context;

/**
 * done自定义view
 */
public class DoneView extends CustomComponent {
    public DoneView(Context context) {
        super(context, null);
    }

    public DoneView(Context context, AttrSet attrSet) {
        super(context, attrSet, null);
    }

    public DoneView(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }

    @Override
    public void setPath() {
        path.reset();
        path.moveTo(width * 13 / 32, height * 8 / 16);
        path.lineTo(width * 15 / 32, height * 9 / 16);
        path.lineTo(width * 21 / 32, height * 6 / 16);
    }

    @Override
    public void setDescription() {
        super.setAccessibilityDescription("DONE");
    }

    /**
     * 设置画笔颜色及圆形背景色
     *
     * @param color color值
     */
    public void setColor(Color color) {
        circlceColor = alphaColor + color.getValue();
        paint.setColor(color);
        invalidate();
    }
}
